<?php
error_reporting(E_ALL ^ E_NOTICE);
ini_set('memory_limit', '1000M');
set_time_limit(0);
CONST TYPE_NORMAL = 1;
CONST TYPE_BAD = 2;
#CONST ETL_TYPE = 'EXIST';
CONST ETL_TYPE = 'NEW';
include_once('function.php');
include_once('sell.php');
include_once('rent.php');
#include_once('sell_table_config.php');
$borough_file_name = 'borough';


$borough = array();
$borough_info = array();
$borough_file = file($borough_file_name);
foreach($borough_file as &$line_json){
    $line = json_decode($line_json, True);
    $borough[$line['borough_name']] = 
	array('id'=>$line['id'], 'cityarea_id'=>$line['cityarea_id'], 'cityarea2_id'=>$line['cityarea2_id'],'subway'=>$line['subway']);
}
while (($line_json = fgets(STDIN)) !== false) {
    $line_json = trim($line_json);
    if(empty($line_json))
        continue;
    $house_info = json_decode($line_json, true);
    $house_info['borough_name'] = trimall($house_info['borough_name']);
    if ($borough[$house_info['borough_name']]){
        if ($house_info['borough_id'] != $borough[$house_info['borough_name']]['id']){
#echo $house_info['borough_name']."\t".$house_info['borough_id']."\t".$borough[$house_info['borough_name']]['id']."\n";
        }
    }
    else if ($house_info['borough_name'] != '未知小区')
            echo $house_info['borough_name']."\t".$house_info['borough_id']."\n";
}
